---
title: 'clearAllLocalStorage | Cypress Documentation'
description: Clear all localStorage data in Cypress.
sidebar_label: clearAllLocalStorage
---

<ProductHeading product="app" />

# clearAllLocalStorage

Clear
[`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage)
data for all origins with which the test has interacted.

:::caution

Cypress automatically clears all local storage _before_ each test to prevent
state from being shared across tests when
[test isolation](/app/core-concepts/writing-and-organizing-tests#Test-Isolation)
is enabled. You shouldn't need to use this command unless you're using it to
clear localStorage inside a single test or test isolation is disabled.

:::

## Syntax

```javascript
cy.clearAllLocalStorage()
cy.clearAllLocalStorage(options)
```

### Usage

<Icon name="check-circle" color="green" /> **Correct Usage**

```javascript
cy.clearAllLocalStorage()
```

### Arguments

<Icon name="angle-right" /> **options _(Object)_**

Pass in an options object to change the default behavior of
`cy.clearAllLocalStorage()`.

| Option | Default | Description                                                                         |
| ------ | ------- | ----------------------------------------------------------------------------------- |
| `log`  | `true`  | Displays the command in the [Command log](/app/core-concepts/open-mode#Command-Log) |

<HeaderYields />

- `cy.clearAllLocalStorage()` yields `null`.

## Rules

<HeaderRequirements />

- `cy.clearAllLocalStorage()` requires being chained off of `cy`.

<HeaderAssertions />

- `cy.clearAllLocalStorage()` cannot have any assertions chained.

<HeaderTimeouts />

- `cy.clearAllLocalStorage()` cannot time out.

## See also

- [`cy.clearAllSessionStorage()`](/api/commands/clearallsessionstorage)
- [`cy.clearCookies()`](/api/commands/clearcookies)
- [`cy.clearLocalStorage()`](/api/commands/clearlocalstorage)
- [`cy.getAllLocalStorage()`](/api/commands/getalllocalstorage)
- [`cy.getAllSessionStorage()`](/api/commands/getallsessionstorage)
